Skip to content

Conversation

rainsxng
Copy link
Contributor

@rainsxng rainsxng commented Sep 29, 2025

Summary

This PR adds a new page describing the HttpClientLatency extension methods. This API was long presented in the dotnet/extensions, but it was never documented except for the readme in the project itself. The latest changes were merged in dotnet/extensions#6783, so this PR reflects those changes as well


Internal previews

📄 File 🔗 Preview link
docs/core/extensions/httpclient-latency-extensions.md docs/core/extensions/httpclient-latency-extensions
docs/fundamentals/toc.yml docs/fundamentals/toc

@rainsxng rainsxng self-assigned this Oct 9, 2025
@rainsxng rainsxng marked this pull request as ready for review October 9, 2025 14:15
@rainsxng rainsxng requested review from a team and IEvangelist as code owners October 9, 2025 14:15
@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 14:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive documentation for the HttpClientLatency extension methods, which provide detailed timing information for HTTP client requests. The documentation covers configuration, usage patterns, and integration with other related services.

  • Adds a new documentation page explaining HTTP client latency telemetry features and configuration
  • Updates the table of contents to include the new documentation page
  • Provides code examples for registration, configuration, and usage of the telemetry features

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/fundamentals/toc.yml Adds navigation entry for the new HTTP client performance monitoring documentation
docs/core/extensions/httpclient-latency-extensions.md Creates comprehensive documentation covering HTTP client latency telemetry configuration, usage, and platform considerations

Comment on lines +47 to +48
// Add HTTP client latency telemetry
builder.Services.AddHttpClientLatencyTelemetry();
Copy link
Member

@evgenyfedorov2 evgenyfedorov2 Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be highlighted in yellow color?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the "== text ==" syntax? IIRC it won't work in the code block 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a way for it, please let me know what you think of it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting HTML is forbidden, so I had to revert it. Not sure whether there's some another way to highlight code inside of the code block

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, code blocks should be located in separate *.cs files. That way, it will be possible to highlight lines

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


### Configure telemetry options

You configure telemetry collection through the `HttpClientLatencyTelemetryOptions` (standard options pattern).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard options pattern - it should contain a link to the Options pattern documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

### Configure telemetry options

You configure telemetry collection through the `HttpClientLatencyTelemetryOptions` (standard options pattern).
You can supply values either with a delegate or by binding configuration (for example, appsettings.json).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can supply values either with a delegate or by binding configuration (for example, appsettings.json).
You can supply values either with a delegate or by binding configuration (for example, `appsettings.json`).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Measures are numeric values captured during a request that quantify things your timestamp checkpoints alone
don't show - like how long GC pauses stalled the thread or how often a brand-new connection had to be opened instead of
reusing a pooled one. Use them when total latency is higher than the sum of visible phases, when investigating memory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use them when total latency is higher than the sum of visible phases, when investigating memory

How can I use them? This information is missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


#### Tags

Use tags to attach stable categorical dimensions to each request so you can segment, filter, and aggregate metrics and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tags to attach stable categorical dimensions to each request - how can I do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


## Usage example

### Track HTTP request client latency
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sub-title is not needed, I think. The whole article is dedicated to tracking HTTP request client latency already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 14 to 17
extension enables collection of detailed timing information for outgoing HTTP calls with no changes to calling code.
It plugs into the existing `HttpClientFactory` pipeline to capture stage timings across the request lifecycle, record
HTTP protocol details, measure garbage collection impact where the runtime exposes that data, and emit a uniform
telemetry shape suitable for performance analysis and tuning.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it needs more details.
When this information is collected, what happens next? Does this component produce some logs, metrics, or something else? In other words, what are the output artifacts?

Same questions apply to Measure, Tags, Timing checkpoints

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants